package kassiopeia.gui

import kassiopeia.commons.TaskSummary;
import kassiopeia.commons.io.Ping;
import org.apache.activemq.command.ActiveMQObjectMessage;
import org.apache.log4j.Logger;

class PingGeneratorJob {
    private static final Logger log = Logger.getLogger(PingGeneratorJob.class)
    private static final boolean enabled = false

    static random = new Random(new Date().getTime())
    static agents = ['bond001', 'bond002']

    def timeout = 3000l
    MessageSenderService messageSenderService

    TaskSummary task = new TaskSummary("Saple task", "Sample task description")

    def execute() {
        if(!enabled) return
        Ping ping
        if(random.nextBoolean()) {
            ping = PingFactory.getPing(agents[0],AgentStatus.IDLE, null)
        } else {
            ping = PingFactory.getPing(agents[1],AgentStatus.TASK, task)
        }
        messageSenderService.broadcaset(ping)
    }
}
